package com.nobuyme.box.toy;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.nobuyme.box.R;
import com.nobuyme.box.account.Account;
import com.nobuyme.box.account.AccountManager;
import com.nobuyme.box.util.FragmentUtils;
import com.nobuyme.box.util.StrokeTextView;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

import butterknife.Bind;
import butterknife.OnClick;


public class ToyManageListActivity extends BaseActivity {

    @Bind(R.id.stv_manage_top)
    StrokeTextView mStvManageTop;
    @Bind(R.id.stv_manage_num)
    StrokeTextView mStvManageNum;
    private int status;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        hideToolbar();
        initData();
    }

    private void initData() {
        final Account acc = AccountManager.getCurrentAccount();
        mStvManageTop.setText(acc.getName());
        mStvManageNum.setText(acc.getToybox_code());
    }

    public static void start(Activity activity,int status) {
        Intent intent = new Intent(activity, ToyManageListActivity.class);
        intent.putExtra("status",status);
        activity.startActivity(intent);
    }

    public static void start(Context context) {
        Intent intent = new Intent(context, ToyManageListActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        context.startActivity(intent);
    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.activity_toy_manage_list, null);
        status = getIntent().getIntExtra("status", -1);
        ToyManageListFragment toyManageListFragment = new ToyManageListFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("status",status);
        toyManageListFragment.setArguments(bundle);
        FragmentUtils.replaceFragment(getSupportFragmentManager(), R.id.fl_manage_list, toyManageListFragment);
        return inflate;
    }

    @OnClick(R.id.btn_manage_list_back)
    public void onViewClicked() {
       finish();

    }


}
